package com.ethanzzh.security.ethanzzhcore.config;



import com.ethanzzh.security.ethanzzhcore.properties.SecurityProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

//这是一个作用类
@Configuration
//作用是让SecurityProperties类到读取器生效
@EnableConfigurationProperties(SecurityProperties.class)

public class SecurityConfig {


    //密码加密的配置 如果使用原先没有加密的密码登录，也会报错
    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
}
